﻿using FSM.IBll;
using FSM.Web.Models;
using FSM.Web.Models.Fileter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FSM.Web.Controllers.SysSetting
{
    [Authorize]
    public class SysSettingController : Controller
    {
        #region 模块

        private readonly DataResultModel drm;

        private readonly ISysParamSubBll _sysParamSubBll;

        #endregion

        #region 构造函数

        public SysSettingController(ISysParamSubBll sysParamSubBll)
        {
            this.drm = new DataResultModel();
            this._sysParamSubBll = sysParamSubBll;
        }

        #endregion

        /// <summary>
        /// 获得登录类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ResultExceptionFilter]
        public JsonResult GetLoginType()
        {
            var modelList = _sysParamSubBll.List(3, "", "");
            drm.success = true;
            drm.data = modelList;
            return drm.ToJson();
        }

        /// <summary>
        /// 获得登录终端类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ResultExceptionFilter]
        public JsonResult GetLoginTerminal()
        {
            var modelList = _sysParamSubBll.List(4, "", "");
            drm.success = true;
            drm.data = modelList;
            return drm.ToJson();
        }

        /// <summary>
        /// 状态类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ResultExceptionFilter]
        public JsonResult GetStatus()
        {
            var modelList = _sysParamSubBll.List(5, "", "");
            drm.success = true;
            drm.data = modelList;
            return drm.ToJson();
        }

        /// <summary>
        /// 厂区类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ResultExceptionFilter]
        public JsonResult GetFactories()
        {
            var modelList = _sysParamSubBll.List(7, "", "");
            drm.success = true;
            drm.data = modelList;
            return drm.ToJson();
        }

        /// <summary>
        /// 设备类型
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ResultExceptionFilter]
        public JsonResult GetMacTypes()
        {
            var modelList = _sysParamSubBll.List(8, "", "");
            drm.success = true;
            drm.data = modelList;
            return drm.ToJson();
        }
    }
}
